﻿
using System;
using HttpApiGateway.Interface;

using RpcModular;

namespace HttpApiGateway.Config
{
    [RpcClient.Attr.IgnoreIoc]
    internal class ModularConfig : IModularConfig
    {
        private IAccreditService _Accredit;

        public ModularConfig()
        {
            this._Accredit = RpcClient.RpcClient.Unity.Resolve<IAccreditService>();
            this.ApiRouteFormat = ApiGatewayService.Config.ApiRouteFormat;
            this.IsAccredit = true;
        }
        /// <summary>
        /// 是否登陆认证
        /// </summary>
        public bool IsAccredit
        {
            get;
            set;
        }
        /// <summary>
        ///  Api 接口路径生成格式
        /// </summary>
        public string ApiRouteFormat
        {
            get;
            set;
        }

        /// <summary>
        /// 获取用户授权状态
        /// </summary>
        /// <param name="accreditId"></param>
        /// <returns></returns>
        public IUserState GetAccredit(Guid accreditId)
        {
            return this._Accredit.GetAccredit(accreditId);
        }
    }
}
